home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Examples / Printer / HP_DeskJet_CMYK / locale.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-30  |  1.7 KB  |  88 lines

  1. /*
  2.  * $Id: locale.c 44.2 1999/09/29 14:03:20 olsen Exp olsen $
  3.  *
  4.  * :ts=4
  5.  *
  6.  * COPYRIGHT:
  7.  *
  8.  *   Unless otherwise noted, all files are Copyright (c) 1999 Amiga, Inc.
  9.  *   All rights reserved.
  10.  *
  11.  * DISCLAIMER:
  12.  *
  13.  *   This software is provided "as is". No representations or warranties
  14.  *   are made with respect to the accuracy, reliability, performance,
  15.  *   currentness, or operation of this software, and all use is at your
  16.  *   own risk. Neither Amiga nor the authors assume any responsibility
  17.  *   or liability whatsoever with respect to your use of this software.
  18.  *
  19.  */
  20.  
  21. #define CATCOMP_ARRAY
  22. #include "global.h"
  23.  
  24. /****************************************************************************/
  25.  
  26. struct Library * LocaleBase;
  27. struct Catalog * Catalog;
  28.  
  29. /****************************************************************************/
  30.  
  31. VOID
  32. LocaleCleanup(VOID)
  33. {
  34.     if(LocaleBase != NULL)
  35.     {
  36.         CloseCatalog(Catalog);
  37.         Catalog = NULL;
  38.  
  39.         CloseLibrary(LocaleBase);
  40.         LocaleBase = NULL;
  41.     }
  42. }
  43.  
  44. /****************************************************************************/
  45.  
  46. VOID
  47. LocaleSetup(VOID)
  48. {
  49.     LONG i;
  50.  
  51.     LocaleBase = OpenLibrary("locale.library",38);
  52.     if(LocaleBase != NULL)
  53.         Catalog = OpenCatalog(NULL,"sys/devs.catalog",NULL);
  54.  
  55.     for(i = 1 ; i <= 7 ; i++)
  56.         DensityNames[i] = Quote(MSG_HPDJ_DENSITY1_TXT+i-1);
  57. }
  58.  
  59. /****************************************************************************/
  60.  
  61. STRPTR
  62. Quote(LONG id)
  63. {
  64.     STRPTR result = NULL;
  65.     LONG i;
  66.  
  67.     for(i = 0 ; i < NUM_ENTRIES(CatCompArray) ; i++)
  68.     {
  69.         if(CatCompArray[i].cca_ID == id)
  70.         {
  71.             result = CatCompArray[i].cca_Str;
  72.             break;
  73.         }
  74.     }
  75.  
  76.     if(result != NULL)
  77.     {
  78.         if(LocaleBase != NULL && Catalog != NULL)
  79.             result = GetCatalogStr(Catalog,id,result);
  80.     }
  81.     else
  82.     {
  83.         result = "";
  84.     }
  85.  
  86.     return(result);
  87. }
  88.